package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.RequestLog;
import com.ruoyi.system.domain.vo.RequestLogPageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.IngreVat;
import com.ruoyi.system.service.IIngreVatService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 储罐可执行动作配置Controller
 *
 * @author ruoyi
 * @date 2025-02-12
 */
@RestController
@RequestMapping("/system/vat")
@Api(tags = "储罐可执行动作配置")
public class IngreVatController extends BaseController
{
    @Autowired
    private IIngreVatService ingreVatService;

    /**
     * 查询储罐可执行动作配置列表
     */
    @PreAuthorize("@ss.hasPermi('system:vat:list')")
    @ApiOperation(value = "查询储罐可执行动作配置列表", notes = "储罐可执行动作配置列表")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody IngreVat ingreVat, @RequestParam Integer pageNum, @RequestParam Integer pageSize){
        List<IngreVat> list = ingreVatService.selectIngreVatList(ingreVat,pageNum,pageSize);
        Long total = ingreVatService.selectIngreVatCount(ingreVat);
        return getDataTable(list, total);

    }
    /**
     * 导出储罐可执行动作配置列表
     */
    @PreAuthorize("@ss.hasPermi('system:vat:export')")
    @Log(title = "储罐可执行动作配置", businessType = BusinessType.EXPORT)
    @ApiOperation(value = "导出储罐可执行动作配置列表", notes = "储罐可执行动作配置列表")
    @PostMapping("/export")
    public void export(HttpServletResponse response, IngreVat ingreVat)
    {
        List<IngreVat> list = ingreVatService.selectIngreVatAll(ingreVat);
        ExcelUtil<IngreVat> util = new ExcelUtil<IngreVat>(IngreVat.class);
        util.exportExcel(response, list, "储罐可执行动作配置数据");
    }

    /**
     * 获取储罐可执行动作配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:vat:query')")
    @ApiOperation(value = "获取储罐可执行动作配置详细信息", notes = "储罐可执行动作配置详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ingreVatService.selectIngreVatById(id));
    }

    /**
     * 新增储罐可执行动作配置
     */
    @PreAuthorize("@ss.hasPermi('system:vat:add')")
    @ApiOperation(value = "新增储罐可执行动作配置", notes = "储罐可执行动作配置")
    @Log(title = "储罐可执行动作配置", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody IngreVat ingreVat)
    {
        return toAjax(ingreVatService.insertIngreVat(ingreVat));
    }

    /**
     * 修改储罐可执行动作配置
     */
    @PreAuthorize("@ss.hasPermi('system:vat:edit')")
    @Log(title = "储罐可执行动作配置", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "修改储罐可执行动作配置", notes = "储罐可执行动作配置")
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody IngreVat ingreVat)
    {
        return toAjax(ingreVatService.updateIngreVat(ingreVat));
    }

    /**
     * 删除储罐可执行动作配置
     */
    @PreAuthorize("@ss.hasPermi('system:vat:remove')")
    @Log(title = "储罐可执行动作配置", businessType = BusinessType.DELETE)
    @ApiOperation(value = "删除储罐可执行动作配置", notes = "储罐可执行动作配置")
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ingreVatService.deleteIngreVatByIds(ids));
    }
}
